<?php

namespace App\Http\Resources;

use App\Traits\BaseResource;
use Illuminate\Http\Resources\Json\Resource;

class Record extends Resource {
	use BaseResource;

	private function toDefault($request) {
		return $this->filterFields([
			'id' => $this->id,
			'user_id' => $this->user_id,
			'title' => $this->title,
			'content' => $this->content,
			'created_at' => explode('|', date('Y|m-d', strtotime($this->created_at))),
		]);
	}

	private function toComplete($request) {
		return $this->filterFields([
			'id' => $this->id,
			'user_id' => $this->user_id,
			'title' => $this->title,
			'content' => $this->content,
			'status' => $this->status ? $this->status : true,
			'created_at' => explode('|', date('Y|m-d', strtotime($this->created_at))),
		]);
	}
}
